// 企业知识库相关类型定义

// 知识库目录树节点 - 左侧全是目录
export interface KnowledgeTreeNode {
  title: string;
  id: string | number;
  children?: KnowledgeTreeNode[];
  path?: string; // 节点路径
}

// 知识片段
export interface KnowledgeFragment {
  know_id: string | number;
  fragment: string;      // 片段标题
  name: string;         // 文件名
  labels: string[];     // 标签
  content?: string;     // 片段内容
  path?: string;        // 片段路径
}

// 文档详情内容节点
export interface DocumentContent {
  title: string;
  content?: string;
  id: string | number;
  children?: DocumentContent[];
}

// API 请求参数类型
export interface DirTreeParams {
  uname: string;
}

export interface FragmentsParams {
  user: string;
  dir_path: string;
}

export interface FirTreeParams {
  uname: string;
  dir_path: string;
}

export interface EditFragmentParams {
  fragment_path: string;
  uname: string;
  content: string;
}

export interface DeleteFragmentParams {
  uname: string;
  fragment_path: string;
}

export interface CreateDirParams {
  uname: string;
  dir_path: string;
}

// API 响应类型
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data: T;
}

export type DirTreeResponse = ApiResponse<KnowledgeTreeNode[]>;
export type FragmentsResponse = ApiResponse<KnowledgeFragment[]>;
export type DocumentContentResponse = ApiResponse<DocumentContent[]>;
export type CommonResponse = ApiResponse<null>;
